package com.feng.modules.plat.action;

import java.util.Map;

import com.feng.modules.core.action.BaseAction;
import com.feng.modules.plat.service.ILoginService;

@SuppressWarnings("unchecked")
public class LoginAction extends BaseAction {
	private ILoginService loginService;

	/**
	 * 返回0-用户名不存在；1-密码不正确；2-登录成功
	 * 
	 * @return i
	 */
	public void login() {
		Map<String, Object> map = this.getParametersToMap();
		int i = loginService.saveLogin(map,this.getServletRequest());
		try {
			this.outJson(i);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public void logout(){
		loginService.logout(getParametersToMap(),getServletRequest());
	}

	public void setLoginService(ILoginService loginService) {
		this.loginService = loginService;
	}

}
